/*
 *    Copyright (c) 2018-2025, boss All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the boss developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: boss
 */

package com.hopes.bizz.basic.hazard.source.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hopes.bizz.basic.common.constant.enums.ParkBasicModDictEnum;
import com.hopes.bizz.basic.common.constant.enums.ParkBasicSysDictEnum;
import com.hopes.bizz.common.core.util.DateUtils;
import com.hopes.boss.admin.api.resolver.DictResolver;
import com.hopes.boss.admin.api.resolver.enums.AdminDictEnum;
import com.hopes.boss.admin.api.resolver.enums.SysDictEnum;
import com.hopes.boss.common.entity.BaseLogicEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 重大危险源
 *
 * @author daijie
 * @date 2023-10-25 11:00:10
 */
@Data
@TableName(value = "haz_hazard_source")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "重大危险源")
public class HazHazardSourceEntity extends BaseLogicEntity {

    private static final long serialVersionUID = 1L;


    /**
     * 标识
     */
    @TableId(type = IdType.ASSIGN_ID)
    @Schema(description = "标识")
    private Long id;

    /**
     * 危险源编码
     */
    @Schema(description = "危险源编码")
    private String hazardCode;

    /**
     * 危险源名称
     */
    @Schema(description = "危险源名称")
    private String hazardName;

    /**
     * 危险源简称
     */
    @Schema(description = "危险源简称")
    private String shortName;

    /**
     * 关联存储场所id
     */
    @Schema(description = "关联存储场所id")
    private String storageIds;

    /**
     * 危险源地址
     */
    @Schema(description = "危险源地址")
    private String hazardAddress;

    /**
     * 占地面积 (㎡)
     */
    @Schema(description = "占地面积 (㎡)")
    private BigDecimal floorArea;

    /**
     * 危险源类型
     */
    @Schema(description = "危险源类型")
    private String hazardType;

    /**
     * 所处环节
     */
    @Schema(description = "所处环节")
    private String hazardStep;

    /**
     * 是否重大危险源
     */
    @Schema(description = "是否重大危险源")
    private Boolean isHazardSource;

    /**
     * 危险源级别
     */
    @Schema(description = "危险源级别")
    private String hazardSourceLevel;

    /**
     * R值
     */
    @Schema(description = "R值")
    private BigDecimal riskValue;

    /**
     * 经度
     */
    @Schema(description = "经度")
    private String longitude;

    /**
     * 纬度
     */
    @Schema(description = "纬度")
    private String latitude;

    /**
     * 高度
     */
    @Schema(description = "高度")
    private String altitude;

    /**
     * 定位
     */
    @Schema(description = "定位")
    private String hazardSourceLocation;

    /**
     * 范围
     */
    @Schema(description = "范围")
    private String hazardSourceScope;

    /**
     * 投用时间
     */
    @Schema(description = "投用时间")
    private Date hazardUseDate;

    /**
     * 500m范围内人数
     */
    @Schema(description = "500m范围内人数")
    private Integer peopleNum;

    /**
     * 重点防护目标最近距离
     */
    @Schema(description = "重点防护目标最近距离")
    private Integer protectDistance;

    /**
     * 极端事故伤亡半径
     */
    @Schema(description = "极端事故伤亡半径")
    private Integer casualtyRadius;

    /**
     * 极端可能伤亡人数
     */
    @Schema(description = "极端可能伤亡人数")
    private Integer casualtyNum;

    /**
     * 生产能力
     */
    @Schema(description = "生产能力")
    private BigDecimal capacity;

    /**
     * 备案期限起
     */
    @Schema(description = "备案期限起")
    private Date filingBegin;

    /**
     * 备案期限止
     */
    @Schema(description = "备案期限止")
    private Date filingEnd;

    /**
     * 是否涉及18种危险工艺
     */
    @Schema(description = "是否涉及18种危险工艺")
    private Boolean chemicalProcessFlag;

    /**
     * 所属18种危险化工工艺
     */
    @Schema(description = "所属18种危险化工工艺")
    private String chemicalProcess;

    /**
     * 危险源描述
     */
    @Schema(description = "危险源描述")
    private String hazardDesc;

    /**
     * 控制措施
     */
    @Schema(description = "控制措施")
    private String controlDesc;

    /**
     * 三年内事故情况
     */
    @Schema(description = "三年内事故情况")
    private String accidentSituation;

    /**
     * 备注
     */
    @Schema(description = "备注")
    private String remarks;

    /**
     * 辨识日期
     */
    @Schema(description = "辨识日期")
    private Date identifyDate;

    /**
     * 辨识状态
     */
    @Schema(description = "辨识状态")
    private String identifyStatus;

    /**
     * 下次辨识日期
     */
    @Schema(description = "下次辨识日期")
    private Date nextIdentifyDate;

    /**
     * 是否位于工业园区内
     */
    @Schema(description = "是否位于工业园区内")
    private Boolean isInPark;

    /**
     * 运行状态
     */
    @Schema(description = "运行状态")
    private String runningStatus;

    /**
     * 主要负责人
     */
    @Schema(description = "主要负责人")
    private Long controlUserId;

    /**
     * 技术负责人
     */
    @Schema(description = "技术负责人")
    private Long techUserId;

    /**
     * 操作负责人
     */
    @Schema(description = "操作负责人")
    private Long operateUserId;

    /**
     * 是否已配置监测
     */
    @Schema(description = "是否已配置监测")
    private Boolean monitorFlag;

    /**
     * 填报人
     */
    @Schema(description = "填报人")
    private String fillingPerson;

    /**
     * 图片
     */
    @Schema(description = "图片")
    private String img;

    /**
     * 关联视频编码
     */
    @Schema(description = "关联视频编码")
    private String videoCodes;

    /**
     * 机构ID
     */
    @Schema(description = "机构ID")
    private Long orgId;


    public String getOrgIdStr() {
        return DictResolver.getItemLabelByValue(AdminDictEnum.sys_company, this.orgId);
    }

    public String getControlUserIdStr() {
        return DictResolver.getItemLabelByValue(AdminDictEnum.sys_user, this.controlUserId);
    }

    public String getTechUserIdStr() {
        return DictResolver.getItemLabelByValue(AdminDictEnum.sys_user, this.techUserId);
    }

    public String getOperateUserIdStr() {
        return DictResolver.getItemLabelByValue(AdminDictEnum.sys_user, this.operateUserId);
    }

    public String getIdentifyDateStr() {
        return DateUtils.limitDay(this.identifyDate);
    }

    public String getHazardUseDateStr() {
        return DateUtils.limitDay(this.hazardUseDate);
    }

    public String getNextIdentifyDateStr() {
        return DateUtils.limitDay(this.nextIdentifyDate);
    }

    public String getFilingBeginStr() {
        return DateUtils.limitDay(this.filingBegin);
    }

    public String getFilingEndStr() {
        return DateUtils.limitDay(this.filingEnd);
    }

    public String getHazardStepStr() {
        return DictResolver.getItemLabelByValue(ParkBasicSysDictEnum.hazard_step, this.hazardStep);
    }

    public String getHazardSourceLevelStr() {
        return DictResolver.getItemLabelByValue(ParkBasicSysDictEnum.haz_hazard_source_level, this.hazardSourceLevel);
    }

    public String getIdentifyStatusStr() {
        return DictResolver.getItemLabelByValue(ParkBasicSysDictEnum.hazard_identify_status, this.identifyStatus);
    }

    public String getRunningStatusStr() {
        return DictResolver.getItemLabelByValue(ParkBasicSysDictEnum.hazard_running_status, this.runningStatus);
    }

    public String getChemicalProcessStr() {
        return DictResolver.getItemLabelByValue(ParkBasicSysDictEnum.hazard_chemical_process, this.chemicalProcess);
    }

    public String getStorageIdsStr() {
        return DictResolver.getItemLabelByValue(ParkBasicModDictEnum.storage_info, this.storageIds);
    }

    public String getIsHazardSourceStr() {
        return DictResolver.getItemLabelByValue(SysDictEnum.yes_no_type, this.isHazardSource);
    }

    public String getChemicalProcessFlagStr() {
        return DictResolver.getItemLabelByValue(SysDictEnum.yes_no_type, this.chemicalProcessFlag);
    }

    public String getIsInParkStr() {
        return DictResolver.getItemLabelByValue(SysDictEnum.yes_no_type, this.isInPark);
    }
}
